#ifndef TEXTDIALOG_H
#define TEXTDIALOG_H

#include "gcxavg.h"
#include <vector>

class TextLabel;
class OrganizedTextContext;

class TextDialog
{
public:
    static const int FLAG_NORMAL = 0x0;
    static const int FLAG_END_OF_LINE = 0x1;
    static const int FLAG_END_OF_PARAGRAPH = 0x2;
    static const int FLAG_END_OF_PAGE = 0x4;
    static const int FLAG_END_OF_TEXT = 0x8;

    TextDialog(TextLabel *);

    // Set text to display next character, return flags of ending
    int next();

    // Is the given integer in the given array?
    bool isInArray(int, std::vector<int> *);

    // Get the text label
    TextLabel * getTextLabel(){
        return _textLabel;
    }

    // Get current index of character
    int getCurrentIndex(){
        return _currChar;
    }

    // Get current index of page
    int getCurrentPage(){
        return _currPage;
    }

    // Active the dialog, enable next() function
    void active(){
        _stoped = false;
    }

private:
    TextLabel * _textLabel;
    OrganizedTextContext * _textContext;
    XCHAR * _text;
    int _currChar;
    int _currPage;
    bool _stoped;
    int _currFlag;
};

#endif // TEXTDIALOG_H
